<template>
  <div class="main">
    <el-container>
      <el-aside :width="isFold ? '60px' : '210px'"
        ><Menu :isFold="isFold"
      /></el-aside>
      <el-container>
        <el-header><Header @foldMenu="foldMenu" /></el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import Menu from './components/menu.vue'
import Header from './components/header.vue'
export default defineComponent({
  name: 'Main',
  components: { Menu, Header },
  setup () {
    const isFold = ref(false)
    const foldMenu = () => {
      isFold.value = !isFold.value
    }
    return { foldMenu, isFold }
  }
})
</script>

<style scoped lang="less">
.main {
  height: 100%;
  .el-container {
    height: 100%;
  }
}
.el-header {
  background-color: #b3c0d1;
}

.el-aside {
  background-color: #081f33;
  height: 100%;
  text-align: center;
  transition: width 0.15s;
  -webkit-transition: width 0.15s;
  -moz-transition: width 0.15s;
  -webkit-transition: width 0.15s;
  -o-transition: width 0.15s;
}

.el-main {
  background-color: #e9eef3;
  color: var(--el-text-color-primary);
  text-align: center;
}
</style>
